import { useState } from "react";
function Acc() {
  // 普通js变量无法触发组件更新
  // let count = 0;
  //useState可以触发组件更新
  const [count, setCount] = useState(0);

  // 点击累加
  function add() {
    setCount(count + 1);
    // console.log(count);
  }

  return (
    <>
      <button onClick={add}> click to accumulate：{count} </button>
    </>
  );
}

export default Acc;
